package com.tarena.test;

import java.awt.Label;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.Scanner;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class FrameDemo {
	public static void main(String[] args) throws IOException{
		Class cls = FrameDemo.class;
		URL url = cls.getResource("fuck.png");
		ImageIcon img = new ImageIcon(url);
		url = cls.getResource("new.txt");
		InputStream in = url.openStream();
		Scanner scanner = new Scanner(in);
		String str = scanner.nextLine();
		scanner.close();
		JFrame frame = new JFrame();
		JPanel panel = new JPanel();
		JLabel label = new JLabel(img);
		JLabel text = new JLabel(str);
		frame.add(panel);
		panel.add(label);
		panel.add(text);
		frame.setVisible(true);
		frame.setSize(300,200);
		frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		frame.setTitle("resource");
	}

}
